package org.jsola.hr.provider.impl;

import org.jsola.core.Page;
import org.jsola.hr.provider.ILogProviderService;
import org.jsola.log.common.LogKit;
import org.jsola.log.query.ActionLogQuery;
import org.jsola.log.query.ServiceLogQuery;
import org.jsola.log.service.IActionLogService;
import org.jsola.log.service.IServiceLogService;
import org.jsola.log.vo.ActionLogListVO;
import org.jsola.log.vo.ServiceLogListVO;
import org.jsola.user.core.TokenUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author june
 */
@Service("adminLogProviderService")
public class LogProviderServiceImpl implements ILogProviderService {

    @Autowired
    private IActionLogService actionLogService;

    @Autowired
    private IServiceLogService serviceLogService;

    @Override
    public void log(String content, Integer actionType, String subjectType, String subjectId, TokenUser tokenUser) {
        LogKit.log(content, actionType, subjectType, subjectId, tokenUser);
    }

    @Override
    public void log(String content, Integer actionType, String subjectType,
                    String subjectId, String contentId, TokenUser tokenUser) {
        LogKit.log(content, actionType, subjectType, subjectId, contentId, tokenUser);
    }

    @Override
    public Page<ActionLogListVO> selectActionLogPage(ActionLogQuery actionLogQuery, String siteId) {
        return actionLogService.selectPage(actionLogQuery, siteId);
    }

    @Override
    public Page<ServiceLogListVO> selectServiceLogPage(ServiceLogQuery serviceLogQuery, String siteId) {
        return serviceLogService.selectPage(serviceLogQuery, siteId);
    }

    @Override
    public Page<ServiceLogListVO> selectServiceLogPageNotSiteId(ServiceLogQuery serviceLogQuery) {
        return serviceLogService.pageNotSiteId(serviceLogQuery);
    }
}
